<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        /* 
        promise实例有两个属性
        promisestate:代表当前promise实例的状态
            pending:异步代码正在执行
            fulfilled:异步代码执行成功
            rejected:异步代码执行失败
        promiseresult:promise实例成功或者失败的值
            默认是undefined
            如果resolve或reject中传递了参数,则值就变成了这个参数
        */
        const p = new Promise((resolve,reject)=>{
            console.log('请求获取A数据');
            setTimeout(() => {
                console.log('A数据获取成功');
                // resolve('成功')
                reject('失败')
                console.log('我是回调函数里面的代码');
            }, 1000);
        })
        console.log('p',p)
    </script>
</body>
</html>